<section class="top">
    <a href="{:U('Index/Index/index')}">
    <div class="logo">
        <p><img src="images/logo.png" alt="" style="width: 53px;margin-top: -1.3rem"></p>
        <span class="sysname" style="margin-top:0px;width: 115px;text-align: center;" >{$sys_name}</span>
        <span>
            <small style="position: relative;width: 115px;display: block;text-align: center;fon;color:#b0e2dd">
                <em style="width: 15px;display: block;border-bottom: 1px solid #55bfb4;position: absolute;top: 8px;left: 0"></em> XINGFUBA<em style="width: 15px;display: block;border-bottom: 1px solid #55bfb4;position: absolute;;top: 8px;right: 0"></em>
            </small>
        </span>
    </div>
    </a>
    <div class="gang">
        <span class="line"></span>
        <span class="line"></span>
        <span class="line"></span>
    </div>
    <div class="meb" style="position: absolute;top: 0;right: 0;">
        <a class="men_btn" href="#">
            <span class="line"></span>
            <span class="line"></span>
            <span class="line"></span>
        </a>
        <div class="btn_menu">
            <p class="meb_img"><img src="images/header.png" width=44 height=44></p>
            <p class="meb_text">
                <span>{$user_name}</span>
                <em></em>
            </p>
        </div>
        <div class="menu_list">
            <ul>
                <li><a onclick="changemm()" style="cursor: pointer">{$lang.xgmm}</a></li>
                <li><a href="{:U('User/Index/logout')}">{$lang.tc}</a></li>
            </ul>
        </div>
    </div>
</section>

<div id="xgmm" class="sysmsg sysmsg1" <if condition="$xgmm == 1"> style="display:block"</if>>
    <h3>{$lang.xgmm}</h3>
    <form action="{:U('User/xgmm')}"  method="post" name="xgmm_form" id="xgmm_form">
        <div id="showmsg1" class="showmsg showmsg1">
            <div style="width: 100%;float: left">
                <div style="width: 40%;float: left;color: #9d9d9d">{$lang.ndxmm}：</div>
                <input type="text" value="" name="new_pass" class="new_txdz new_txdz1"  style="border: 1px solid #dddddd">
            </div>
            <div style="width: 100%;float: left">
                <div style="width:40%;float: left;color: #9d9d9d">{$lang.sendmail}：</div>
                <input type="text" value="" name="code"  class="txdz_code" style="border: 1px solid #dddddd">
                <input type="button" onclick="send_eml()" id="yzm" value="发送安全码" class="txdz_send">
            </div>
            <input type="hidden" value="{$user_name}" id="username">
            <div style="width: 60%;margin: auto">
                <div class="sub_txdz" onclick="subthis()" style="cursor: pointer">{$lang.sure}</div>
                <div class="close_txdz" onclick="closemm()"style="cursor: pointer">{$lang.close}</div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var time = 60;
    function send_eml(){
        var email = $("#username").val();
        $.ajax({
            type:"GET",
            url:"{:U('User/Index/sendEmail')}",
            data:{email:email},
            dataType: "json",
            success:function(data){
                if(data.error == 0){ //发送成功
                    var timer=null;
                    var t=time;
                    var m=0;
                    var s=0;
                    m=Math.floor(t/60%60);
                    m<10&&(m='0'+m);
                    s=Math.floor(t%60);
                    function countDown(){
                        s--;
                        s<10&&(s='0'+s);
                        if(s.length>=3){
                            s=59;
                            m="0"+(Number(m)-1);
                        }
                        if(m.length>=3){
                            m='00';
                            s='00';
                            clearInterval(timer);
                        }

                        document.getElementById("yzm").value = "已发送 ("+ s +")";
                        document.getElementById("yzm").onclick= "";
                        if(s == '00'){
                            document.getElementById("yzm").value = "发送安全码";
                            document.getElementById("yzm").onclick= send_eml;
                        }
                        console.log(s);
                    }
                    timer=setInterval(countDown,1000);
                }else{
                    document.getElementById("showmsg").innerHTML=data.msg;
                    $("#sysmsg").show();
                }
            }
        })
    }

    function changemm(){
        $("#xgmm").show();
    }
    function closemm(){
        $("#xgmm").hide();
    }

    function subthis(){
        document.getElementById("xgmm_form").submit();
    }
</script>
